import xmlrpclib
import tornado.ioloop
import tornado.web
import json


server = xmlrpclib.Server('http://localhost:9001/RPC2')

class MainHandler(tornado.web.RequestHandler):
    def get(self):
        fun = self.get_argument('fun', 'getAllProcessInfo')
        if fun=='getAllProcessInfo':
        	obj=server.supervisor.getAllProcessInfo()
        	self.write(json.dumps(obj))

application=tornado.web.Application([(r"/",MainHandler),],debug=True)

if __name__=="__main__":
    application.listen(8000)
    tornado.ioloop.IOLoop.instance().start()


